/**
 * 
 */
package edu.ou.cs.youming.jaxb.types;

import java.util.ArrayList;

import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;

/**
 * @author Youming Lin
 * 
 */
@XmlRootElement(name = "DTNode")
public final class DTNode<T> {
	@XmlElement(name = "value", required = true)
	public T value;

	@XmlElement(name = "children")
	public ArrayList<DTNode<?>> children;

	public DTNode() {
		value = null;
		children = new ArrayList<DTNode<?>>();
	}

	public DTNode(final T value) {
		this.value = value;
		children = new ArrayList<DTNode<?>>();
	}

	public void addChild(final DTNode<?> child) {
		this.children.add(child);
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see java.lang.Object#toString()
	 */
	@Override
	public String toString() {
		return "DTNode [value=" + value + ", children=" + children + "]";
	}
}